home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10110 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: news.bridge.net!news
  2. From: psycho@bridge.net (Gary Thompson)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: CONVERTING INTEGER TO ASCII??????
  5. Date: Fri, 15 Mar 1996 17:31:47 GMT
  6. Organization: BridgenetLC - 305.374.3031 - 100 S. Biscayne Blvd, Miami 
  7. Message-ID: <4ic9ll$cfp@news.bridge.net>
  8. References: <4i17r9$2kn@maltese.eag.unisysgsg.com>
  9. NNTP-Posting-Host: ppp-ftl1-19.bridge.net
  10. X-Newsreader: Forte Free Agent 1.0.81
  11.  
  12. ssadra@maltese.eag.unisysgsg.com (Daniel R. Ascheman) wrote:
  13.  
  14. >HI all,
  15.  
  16. >I need a way to convert an integer BACK to ascii so I can search for it 
  17. >in a file using the strstr() function in a file. I NEED it as an integer
  18. >AND as an ascii, is it possible?
  19. >As you know, strstr() is a char *, char * , so I can't use an int,
  20. >and itoa() does not exist in UNIX - I am in a slight bind.
  21.  
  22. >... ... ...
  23.  
  24. >If no conversion is possible in C/UNIX, anyone have any other ideas?
  25.  
  26. >I would greatly appreciate comments and possible solutions.
  27.  
  28. Several ways...
  29.  
  30. sprintf(buff,"%d",intvalue);
  31.  
  32. buff=itoa(intvalue,buff,10); (I think...)
  33.  
  34. Other ways are not so easy...
  35.  
  36.                               Gary Thompson
  37.                                "The Psycho"
  38.                              psycho@bridge.net
  39.                         72607.1365@compuserve.com
  40.                        http://www.bridge.net/~psycho
  41.            HTTP://ourworld.compuserve.com/homepages/psychotps
  42.  
  43.